home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / mimelib / uuencode.h < prev   
Encoding:
C/C++ Source or Header  |  2007-05-14  |  4.4 KB  |  123 lines

  1. //=============================================================================
  2. // File:       uuencode.h
  3. // Contents:   Declarations for DwUuencode
  4. // Maintainer: Doug Sauder <dwsauder@fwb.gulf.net>
  5. // WWW:        http://www.fwb.gulf.net/~dwsauder/mimepp.html
  6. //
  7. // Copyright (c) 1996, 1997 Douglas W. Sauder
  8. // All rights reserved.
  9. // 
  10. // IN NO EVENT SHALL DOUGLAS W. SAUDER BE LIABLE TO ANY PARTY FOR DIRECT,
  11. // INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF
  12. // THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF DOUGLAS W. SAUDER
  13. // HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  14. //
  15. // DOUGLAS W. SAUDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT
  16. // NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
  17. // PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS"
  18. // BASIS, AND DOUGLAS W. SAUDER HAS NO OBLIGATION TO PROVIDE MAINTENANCE,
  19. // SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
  20. //
  21. //=============================================================================
  22.  
  23. #ifndef DW_UUENCODE_H
  24. #define DW_UUENCODE_H
  25.  
  26. #ifndef DW_CONFIG_H
  27. #include <mimelib/config.h>
  28. #endif
  29.  
  30. #ifndef DW_STRING_H
  31. #include <mimelib/string.h>
  32. #endif
  33.  
  34. //=============================================================================
  35. //+ Name DwUuencode -- Class for performing uuencode or uudecode operations
  36. //+ Description
  37. //. {\tt DwUuencode} performs uuencode or uudecode operations.  Uuencode
  38. //. is a format for encoding binary data into text characters for transmission
  39. //. through the mail system.  The format also includes the file name and the
  40. //. file mode.  (Note: The file mode is significant only in UNIX.)  In MIME,
  41. //. the use of uuencode is deprecated; base64 is the preferred encoding
  42. //. for sending binary data.
  43. //.
  44. //. To use {\tt DwUuencode} for encoding binary data into uuencode format,
  45. //. set the file name, file mode, and binary data string using the member
  46. //. functions {\tt SetFileName()}, {\tt SetFileMode()}, and
  47. //. {\tt SetBinaryChars()}.  Then call the member function {\tt Encode()}.
  48. //. Finally, retrieve the uuencoded text characters by calling
  49. //. {\tt AsciiChars()}.
  50. //.
  51. //. To use {\tt DwUuencode} to decode uuencoded data, set the ASCII characters
  52. //. using the member function {\tt SetAsciiChars()}, then call {\tt Decode()}.
  53. //. Finally, retrieve the file name, file mode, and binary characters by
  54. //. calling {\tt FileName()}, {\tt FileMode()}, and {\tt BinaryChars()}.
  55. //=============================================================================
  56. // Last modified 1997-07-29
  57. //+ Noentry ~DwUuencode mFileName mMode mBinaryChars mAsciiChars
  58.  
  59.  
  60. class DW_EXPORT DwUuencode {
  61.  
  62. public:
  63.  
  64.     DwUuencode();
  65.     //. This is the default constructor.
  66.  
  67.     virtual ~DwUuencode();
  68.  
  69.     void Initialize();
  70.     //. Resets the object's internal state to its initial state.  Call
  71.     //. this member function to reuse the object for more than one encode
  72.     //. or decode operation.
  73.  
  74.     void SetFileName(const char* aName);
  75.     //. Sets the file name to be included in the uuencoded output.  The
  76.     //. implementation limits the file name to 255 characters.
  77.  
  78.     const char* FileName() const;
  79.     //. Returns the file name extracted while uudecoding. The implementation
  80.     //. limits the file name to 255 characters.
  81.  
  82.     void SetFileMode(DwUint16 aMode);
  83.     //. Sets the file mode to be included in the uuencoded output.  If
  84.     //. the file mode is not explicitly set using this member function,
  85.     //. a default value of 0644 (octal) is assumed.
  86.  
  87.     DwUint16 FileMode() const;
  88.     //. Returns the file mode extracted while uudecoding.
  89.  
  90.     void SetBinaryChars(const DwString& aStr);
  91.     //. Sets the string of binary data to be used in the uuencode operation.
  92.  
  93.     const DwString& BinaryChars() const;
  94.     //. Returns the string of binary data extracted during a uudecode
  95.     //. operation.
  96.  
  97.     void SetAsciiChars(const DwString& aStr);
  98.     //. Sets the string of ASCII characters to used in the decode operation.
  99.  
  100.     const DwString& AsciiChars() const;
  101.     //. Returns the string of ASCII characters created during a uuencode
  102.     //. operation.
  103.  
  104.     void Encode();
  105.     //. Creates an ASCII string of characters by uuencoding the file name,
  106.     //. file mode, and binary data.
  107.  
  108.     int Decode();
  109.     //. Extracts the file name, file mode, and binary data from the ASCII
  110.     //. characters via a uudecode operation.
  111.  
  112. private:
  113.  
  114.     char     mFileName[256];
  115.     DwUint16 mMode;
  116.  
  117.     DwString mBinaryChars;
  118.     DwString mAsciiChars;
  119.    
  120. };
  121.  
  122. #endif
  123.